home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW Related / DTS MPW Goodies / FindLurkers < prev    next >
Encoding:
Text File  |  1990-09-14  |  6.4 KB  |  193 lines  |  [TEXT/MPS ]

  1. #
  2. #    File:        FindLurkers
  3. #
  4. #    Contains:    script which reports all files that are not what it expects
  5. #
  6. #    Usage:        FindLurkers
  7. #
  8. #    Status:        FindLurkers may return the following status values:
  9. #
  10. #                    0        success
  11. #                    1        error
  12. #
  13. #                FindLurkers compares each CheckOutDir with its corresponding project
  14. #
  15. #    Written by:    scott douglass and Darin Adler
  16. #
  17. #    Copyright:    © 1989 by Apple Computer, Inc., all rights reserved.
  18. #
  19. #    Change History:
  20. #
  21. #        12/6/89        sad        fix option-space character
  22. #        12/6/89        sad        fix rename case
  23. #        11/9/89        dba        twiddle relentlessly
  24. #        9/29/89        sad        check for files in wrong project and files with wrong name
  25. #        9/22/89        sad        fix case of fewer files on disk than in project; put out both version numbers
  26. #        8/4/89        sad        more useful output, notice canceled checkout modifys
  27. #        7/31/89        sad        finished writing
  28. #
  29. #    To Do:
  30. #        can’t handle file name with spaces
  31. #        settings of CaseSensitive and =~ can probably be used instead of RelString
  32. #        If MPW had > and < and for strings we wouldn’t need RelString and would be a lot faster.
  33. #
  34.  
  35. Set Exit 0
  36. Set CaseSensitive 0
  37.  
  38. Begin
  39.  
  40.     # first get all the check-out directories
  41.  
  42.     Set CheckOutDirs "`CheckOutDir -m -r; Set CheckOutDirStatus {Status}; Echo`"
  43.     Exit If {CheckOutDirStatus}
  44.  
  45.     Loop
  46.         Break If "{CheckOutDirs}" !~ / *CheckOutDir +-project ∂'«0,1»([¬:]+∫)®1∂'«0,1» ∂'«0,1»([¬∫]*:)®2∂'«0,1» (≈)®3/
  47.         Set Project "{®1}"
  48.         Set CheckOutDir "{®2}"
  49.         Set CheckOutDirs "{®3}"
  50.  
  51.         # now for each directory, get all modified files in the project
  52.  
  53.         Set Info "`ProjectInfo -s -latest -project "{Project}"; Set ProjectInfoStatus {Status}`"
  54.         If {ProjectInfoStatus} ≠ 0
  55.             Echo "### {0} - ProjectInfo of “{Project}” failed."
  56.             Exit {ProjectInfoStatus}
  57.         End
  58.  
  59.         For File in `Files -s "{CheckOutDir}"`
  60.             Loop
  61.                 Set BreakOut 1
  62.                 Break If "{Info}" !~ /[¬,]*     ∂'«0,1»([¬,]+)®1,([0-9]+)®2([0-9.a-z]*)®3([+*]«0,1»)®4∂'«0,1»(≈)®5/
  63.                 Set BreakOut 0
  64.                 Set ProjectFileName "{®1}"
  65.                 Set ProjectVersNum "{®2}"
  66.                 Set ProjectBranch "{®3}"
  67.                 Set ProjectModFlag "{®4}"
  68.                 Set ProjectVersInfo "{®2}{®3}{®4}"
  69.                 Set ProjectNextInfo "{®5}"
  70.  
  71.                 Set DirFile "{CheckOutDir}{File}"
  72.  
  73. #                If `RelString "{File}" "{ProjectFileName}"` == 0
  74.                 If "{File}" == "{ProjectFileName}"
  75.                     If `Exists "{DirFile}"`"" ≠ ""
  76.                         Set FileInfo "`ProjectInfo "{DirFile}"`"
  77.                         If "{FileInfo}" =~ /∂'«0,1»([¬,]+)®1,([0-9]+)®2([0-9.a-z]*)®3([+*]«0,1»)®4∂'«0,1»(     WARNING: this file has been renamed!)«0,1»≈Project: ([¬:]+∫)®5     Checked out: ≈/
  78.                             Set FileFileName "{®1}"
  79.                             Set FileVersNum "{®2}"
  80.                             Set FileBranch "{®3}"
  81.                             Set FileModFlag "{®4}"
  82.                             Set VersInfo "({®2}{®3}{®4} vs {ProjectVersInfo})"
  83.                             Set FileProject "{®5}"
  84.  
  85. #                            If `RelString "{FileProject}" "{Project}"` ≠ 0
  86.                             If "{FileProject}" ≠ "{Project}"
  87.                                 Quote -n File "{DirFile}"
  88.                                 Echo " ### is in the wrong project (“{FileProject}” vs “{Project}”)"
  89. #                            Else    # if I use “Else If” here RelString is always run (i.e. “If expr1 … Else If expr2 … End” is strict w.r.t. expr2)
  90. #                                If `RelString "{FileFileName}" "{ProjectFileName}"` ≠ 0
  91.                             Else If "{FileFileName}" ≠ "{ProjectFileName}"
  92.                                     Quote -n File "{DirFile}"
  93.                                     Echo " ### has been renamed (from “{ProjectFileName}” to “{File}”)"
  94. #                                End
  95.                             Else If {FileVersNum} < {ProjectVersNum}
  96.                                 Quote -n CheckOut -project "{Project}" "{File}"
  97.                                 Echo -n " ### is old"
  98.                                 If "x{FileModFlag}" == "x*"
  99.                                     Echo -n " and modifyreadonly"
  100.                                 Else If "x{FileModFlag}" == "x+"
  101.                                     Echo -n " and no longer checked out modify"
  102.                                 End
  103.                                 Echo " {VersInfo}"
  104.                             Else If {FileVersNum} > {ProjectVersNum}
  105.                                 Quote -n File "{DirFile}"
  106.                                 Echo " ### is too new {VersInfo}"
  107.                             Else
  108.                                 If "x{FileModFlag}" == "x*"
  109.                                     Quote -n File "{DirFile}"
  110.                                     Echo " ### is modifyreadonly {VersInfo}"
  111.                                 Else If "x{ProjectModFlag}" == "x" && "x{FileModFlag}" == "x+"
  112.                                     Quote -n File "{DirFile}"
  113.                                     Echo " ### check out modify has been canceled {VersInfo}"
  114.                                 End
  115.                             End
  116.                         Else
  117.                             If "{FileInfo}" == ""
  118.                                 Quote -n File "{DirFile}"
  119.                                 Echo " ### is an orphan (vs {ProjectVersInfo})"
  120.                             Else
  121.                                 Echo "### {0} - Couldn’t parse FileInfo (#1): “{FileInfo}”" > Dev:StdErr
  122.                                 Exit 1
  123.                             End
  124.                         End
  125.                     Else
  126.                         Confirm "Oops, file “{DirFile}” exists but doesn’t. (#1)"
  127.                         Exit 1 If {Status}
  128.                     End
  129.                     Set Info "{ProjectNextInfo}"
  130.                     Break
  131.                 Else    # if I use “Else If” here RelString is always run (i.e. “If expr1 … Else If expr2 … End” is strict w.r.t. expr2)
  132.                     If `RelString "{File}" "{ProjectFileName}"` > 0
  133.                         Quote -n CheckOut -project "{Project}" "{ProjectFileName}"
  134.                         Echo " ### is not in “{CheckOutDir}”"
  135.                         Set Info "{ProjectNextInfo}"
  136.                     Else
  137.                         If `Exists "{DirFile}"`"" ≠ ""
  138.                             Set FileInfo "`ProjectInfo "{DirFile}"`"
  139.                             If "{FileInfo}" =~ /∂'«0,1»([¬,]+)®1,([0-9]+)®2([0-9.a-z]*)®3([+*]«0,1»)®4∂'«0,1»(     WARNING: this file has been renamed!)«0,1»≈Project: ([¬:]+∫)®5     Checked out: ≈/
  140.                                 Set FileFileName "{®1}"
  141.                                 Set FileVersNum "{®2}"
  142.                                 Set FileBranch "{®3}"
  143.                                 Set FileModFlag "{®4}"
  144.                                 Set VersInfo "({®2}{®3}{®4} vs {ProjectVersInfo})"
  145.                                 Set FileProject "{®5}"
  146.  
  147. #                                If `RelString "{FileProject}" "{Project}"` ≠ 0
  148.                                 If "{FileProject}" ≠ "{Project}"
  149.                                     Quote -n File "{DirFile}"
  150.                                     Echo " ### is in the wrong project (“{FileProject}” vs “{Project}”)"
  151.                                 Else
  152.                                     Quote -n File "{DirFile}"
  153.                                     Echo " ### is no longer in the project “{Project}”"
  154.                                 End
  155.                             Else
  156.                                 If "{FileInfo}" == ""
  157.                                     Quote -n File "{DirFile}"
  158.                                     Echo " ### is not in the project “{Project}”"
  159.                                 Else
  160.                                     Echo "### {0} - Couldn’t parse FileInfo (#2): “{FileInfo}”" > Dev:StdErr
  161.                                     Exit 1
  162.                                 End
  163.                             End
  164.                         Else
  165.                             Confirm "Oops, file “{DirFile}” exists but doesn’t. (#2)"
  166.                             Exit 1 If {Status}
  167.                         End
  168.                         Break
  169.                     End
  170.                 End
  171.             End
  172.             Break If {BreakOut}
  173.         End
  174.         Loop
  175.             Break If "{Info}" !~ /[¬,]*     ∂'«0,1»([¬,]+)®1,[0-9]+[0-9.a-z]*[+*]«0,1»∂'«0,1»(≈)®5/
  176.             Set ProjectFileName "{®1}"
  177.             Set ProjectNextInfo "{®5}"
  178.             Quote -n CheckOut -project "{Project}" "{ProjectFileName}"
  179.             Echo " ### is not in “{CheckOutDir}”"
  180.             Set Info "{ProjectNextInfo}"
  181.         End
  182.         If "{Info}" ≠ ""
  183.             Echo "### {0} - Couldn’t parse Info: “{Info}”" > Dev:StdErr
  184.             Exit 1
  185.         End
  186.     End
  187.     If "{CheckOutDirs}" ≠ ""
  188.         Echo "### {0} - Couldn’t parse CheckOutDirs: “{CheckOutDirs}”" > Dev:StdErr
  189.         Exit 1
  190.     End
  191.  
  192. End
  193.